package com.kyl.controller;


import cn.hutool.core.date.LocalDateTimeUtil;
import com.kyl.base.PageResponse;
import com.kyl.base.ResponseResult;
import com.kyl.service.NursingTaskService;
import com.kyl.utils.ObjectUtil;
import com.kyl.vo.NursingTaskVo;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author WanJl
 * @version 1.0
 * @title NursingTaskController
 * @description
 * @create 2025/1/18
 */
@RestController
@RequestMapping("/nursingTask")
@Api(tags = "护理任务管理相关接口")
public class NursingTaskController {
    @Resource
    private NursingTaskService nursingTaskService;

    @GetMapping("/page")
    public ResponseResult<PageResponse<NursingTaskVo>> queryPage(
            @RequestParam (value = "pageNum", defaultValue = "1") Integer pageNum,
            @RequestParam (value = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam (value = "status", defaultValue = "1") Integer status,
            @RequestParam (value = "startTime",required = false) Long startTime,
            @RequestParam (value = "endTime",required = false) Long endTime,
            @RequestParam (value = "nurseId",required = false) Long nursingId,
            @RequestParam (value = "elderName",required = false) String elderName,
            @RequestParam (value = "projectId",required = false) Integer projectId
    ){
        PageResponse<NursingTaskVo> page =
                nursingTaskService.getTaskPage(pageNum, pageSize, status,
                        ObjectUtil.isEmpty(startTime)?null:LocalDateTimeUtil.of(startTime),
                        ObjectUtil.isEmpty(endTime)?null:LocalDateTimeUtil.of(endTime) ,
                        nursingId, elderName, projectId);
        return ResponseResult.success(page);
    }














}
